﻿using SqlSugar;
using System;

namespace WMS.Model
{
    [SugarTable("User")]
    public class UserModel : BaseModel
    {
        /// <summary>
        /// 账号
        /// </summary>
        [SugarColumn(ColumnName = "Account", Length = 50, IsNullable = false)]
        public string Account { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        [SugarColumn(ColumnName = "Password", Length = 255, IsNullable = false)]
        public string Password { get; set; }

        /// <summary>
        /// 真实姓名
        /// </summary>
        [SugarColumn(ColumnName = "Realname", Length = 50, IsNullable = false)]
        public string Realname { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        [SugarColumn(ColumnName = "Phone", Length = 20, IsNullable = true)]
        public string? Phone { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [SugarColumn(ColumnName = "Email", Length = 100, IsNullable = true)]
        public string? Email { get; set; }

        /// <summary>
        /// 状态：0-禁用，1-启用
        /// </summary>
        [SugarColumn(ColumnName = "Status")]
        public byte Status { get; set; } = 1;

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "CreateTime")]
        public DateTime? CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>
        [SugarColumn(ColumnName = "UpdateTime")]
        public DateTime? UpdateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 部门
        /// </summary>
        [SugarColumn(ColumnName = "Department")]
        public long Department { get; set; }

        /// <summary>
        /// 用户编码
        /// </summary>
        [SugarColumn(ColumnName = "UserCode")]
        public string UserCode { get; set; }
    }

    public class AddUserModelDto()
    {
        public string Account { get; set; }

        public string? Password { get; set; }

        public string Realname { get; set; }
    }
    public class UpdateUserModelDto()
    {
        public long Id { get; set; }

        public string UserCode { get; set; }
        public string Account { get; set; }

        public string? Password { get; set; }

        public string Realname { get; set; }

        public string? Phone { get; set; }

        public string? Email { get; set; }

        public byte Status { get; set; } = 1;

        public long Department { get; set; }

    }
    public class UserWithAvatarDto
    {
        public long Id { get; set; }
        public string UserCode { get; set; }
        public string Account { get; set; }
        public string Realname { get; set; }
        public string Email { get; set; }
        public string Phone { get; set; }
        public byte Status { get; set; }
        public string DepartmentName { get; set; }
        public string AvatarUrl { get; set; }
    }
    public class UpdateUserPwdDto()
    {
        public long Id { get; set; }
        public string Password { get; set; }
        public string NewPassword { get; set; }
    }
}